''' 算术运算符的重载 '''


class Mynumber():
    def __init__(self,data=[]):
        self.data = data

    def __add__(self, other):
        return self.data + other.data

    def __sub__(self, other):
        return self.data - other.data

    def __mul__(self, rhs):
        return self.data * rhs

    def __mod__(self, other):
        return self.data % other.data


n1 = Mynumber(10)
n2 = Mynumber(20)
# # 当没有重写add时，实现以下操作会出错
# print(n1+n2)

l1 = Mynumber([1,2])
l2 = Mynumber([3,4])

print(l1+l2)
print(l1*2)
print(n1%n2)